json = require("json")
mobox = require("OILua_JavelinExt")
m3 = require("oi_base_mobox")
function GenerateViewHTML(strLuaDEID)
local nRet, strRetInfo
local autoplay = false
local strHtmlTitle = "";
local strHtmlRow = "";
--[[ 获取样式 ]]
local strHtmlStyle = GetHtmlStyle();
--[[ 列明 ]]
local tabTitleList = {"工位", "异常信息"}
--[[ 组织列名 ]]
--[[ class 处理样式 这里 组成(table-col' .. i .. ') table-col1,table-col2,table-col3 ]]
for i = 1, #tabTitleList do
strHtmlTitle = strHtmlTitle .. '
' .. tabTitleList[i] .. '
'
end
-- 获取执行中的作业数据
local tabDataList = {}
local packing_list,packing
local condition = "S_STATION IN ('C','D') AND S_ERR_MSG IS NOT NULL AND S_ERR_MSG <> ''"
nRet, packing_list = m3.QueryDataObject(strLuaDEID, "GT_PDA_Station", condition)
if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "获取工位异常信息失败!" .. packing_list) end
lua.Debug( strLuaDEID, debug.getinfo(1), "#packing_list", #packing_list )
if (#packing_list > 0) then
-- 添加装箱工单信息
for i = 1, #packing_list do
nRet,packing = m3.ObjAttrStrToLuaObj("GT_PDA_Station", lua.table2str(packing_list[i].attrs))
if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "ObjAttrStrToLuaObj失败!"..packing) end
-- if(packing.err_msg ~= '')then
tabDataList[i] = {
station = packing.station,
msg = packing.err_msg
}
-- end
end
-- else
end
if (#tabDataList > 1) then
autoplay = true
end
--[[ 组织行数据html ]]
for i = 1, #tabDataList do
strHtmlRow = strHtmlRow .. '' ..
'
'..tabDataList[i].station .. '
' .. '
' ..
tabDataList[i].msg .. '
' .. '
'
end
--[[ 总html ]]
local strHtml = ' ' .. '
' .. strHtmlTitle .. '
' ..
'
' .. '
'
local action = {}
action[1] = {
action_type = "chart",
value = {
graphicType = "html",
title = {
text = "异常信息",
align = "left",
color = "#fff",
font = "微软雅黑",
fontSize = 18
},
swiper = {
--[[ 容器名称不能重复 不能为空 swiper-container class 需要指定 ]]
containerName = "ycxx1",
--[[ 强制Swiper的宽度(px),"undefined" 或 整数, 当你的Swiper在隐藏状态下初始化时用得上。这个参数会使自适应失效。可设置为undefined使这个参数无效。 ]]
width = "undefined",
--[[ 强制Swiper的高度(px),当你的Swiper在隐藏状态下初始化时且切换方向为垂直才用得上。这个参数会使自适应失效。 ]]
height = 'auto',
--[[ 排列方向 vertical , horizontal ]]
direction = "vertical",
--[[ 切换速度,即slider自动滑动开始到结束的时间(单位ms) ]]
speed = 2000,
--[[ loop 模式如果与 slidesPerView: 'auto' 一起使用,需要设置 loopedSlides 指定要循环(重复)的幻灯片数量。 ]]
loop = true,
-- loopedSlides=10,
--[[ 设置slider容器能够同时显示的slides数量,整数或auto ]]
slidesPerView= 'auto',
--[[ 在slide之间设置距离(单位px)。 ]]
spaceBetween = 10,
--[[ 默认情况下Swiper 每次滑动时只滑动一个Slide,并且会自动贴合Wrapper。开启自由模式后,Swiper 会根据惯性滑动可能不止一格且不会贴合。 ]]
freeMode = false,
--[[ 设定slide与左边框的预设偏移量(单位px)。 垂直就行与上方距离 ]]
slidesOffsetBefore = 10,
--[[ 设定slide与右边框的预设偏移量(单位px)。 垂直就行与下方距离 ]]
slidesOffsetAfter = 10,
--[[是否自动播放,true 需要指定 autoplayDelay ]]
autoplay = autoplay,
--[[ 播放间隔时间,单位ms ]]
autoplayDelay = 100
},
html = strHtmlStyle .. strHtml
}
}
-- Debug( strLuaDEID, debug.getinfo(1), "action! ", action )
nRet, strRetInfo = mobox.setAction(strLuaDEID, json.encode(action))
if (nRet ~= 0) then
lua.Error(strLuaDEID, debug.getinfo(1), "setAction失败! " .. strRetInfo)
end
end
function GetHtmlStyle()
return
''
end